/*
 * @Description:登录
 * @Author: maskMan
 * @LastEditTime: 2024-11-20 18:35:40
 */
import Config from '@/utils/config';
import Mock from '@/api/mock';
import request from '@/api/request';
/**管理者登录 */
export const login = async function (data: TReq.Login): Promise<TRet.Account> {
  if (Config.env == 'Test') {
    return Mock.mock_login();
  }
  const res = await request.get<TRet.Account>('login/admin_login', data);
  return res;
};
/**获取角色权限 */
export const getManageRoles = async function (): Promise<TRet.Role> {
  if (Config.env == 'Test') {
    return Mock.mock_get_manage_roles();
  }
  const res = await request.get<TRet.Role>('admin/getManageRoles');
  return res;
};
/**退出登录 */
export const logOut = async function <T = any>(data: Obj = null): Promise<TRet.Bool> {
  if (Config.env == 'Test') {
    return Mock.mock_logout();
  }
  const res = await request.patch<TRet.Bool>('admin/logOut', data);
  return res;
};
/**获取用户列表 */
export const getUserList = async function (data: Obj = null): Promise<TRet.Base> {
  const res = await request.get('admin/getUserList', data);
  return res as any;
};
